
#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include"Gamemap.h"
#include"Role.h"

namespace Ui {
class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = nullptr);
    virtual void paintEvent(QPaintEvent*event);//绘图事件函数
    virtual void keyPressEvent(QKeyEvent*event);//键盘按下事件
    void Collision(int _dRow,int _dCol);
    bool gameover();

    ~Widget();

private:
    Ui::Widget *ui;

    Gamemap* mPMap;

    QPainter* mMapPainter;
    //角色
    Role* mRole;
    //游戏更新定时器
    QTimer * mTimer;
};

#endif // WIDGET_H
